﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AcmeSportsStore
{
    public partial class NewPasswordView : Form
    {
        private bool compPassword;
        private bool changePassword;
        public NewPasswordView()
        {
            InitializeComponent();
        }

        private void btnOk_NPF_Click(object sender, EventArgs e)
        {
            compPassword = Password.CompPassword(tBoxOldPassword_NPF.Text);
            if (compPassword == true)
            {
                changePassword = Password.NewPassword(tBoxNewPassword1_NPF.Text, tBoxNewPassword2_NPF.Text);
                if (changePassword == true)
                {
                    MessageBox.Show("Successful change password!");
                    this.Close();
                }
                else
                    MessageBox.Show("The password input twice are not the same!");
            }
            else
                MessageBox.Show("The Old password doesn't correct, input again.");
        }

        private void btnCancel_NPF_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void NewPasswordView_Load(object sender, EventArgs e)
        {
            tBoxName_NPF.Text = "";
            tBoxNewPassword1_NPF.Text = "";
            tBoxNewPassword2_NPF.Text = "";
            tBoxOldPassword_NPF.Text = "";
        }
    }
}
